package com.amox.uitest.adapter;

import java.util.List;

import org.dom4j.Element;
import org.dom4j.Node;

import com.amox.uitest.common.KeyWord;
import com.amox.uitest.tcase.BaseTestCase;

public class UitestAdapter extends BaseAdapter<Boolean> {

	private ClassAdapter classAdapter;
	
	public UitestAdapter(BaseTestCase uitest) {
		super(uitest);
		classAdapter = new ClassAdapter(uitest);
	}

	@Override
	public Boolean adapter(Element element) throws Exception {
		List<Node> classes = element.selectNodes(KeyWord.clazz.toString());
		for(Node clazz : classes) {
			if(classAdapter.adapter((Element)clazz)) {
				return false;
			}
		}
		
		return true;
	}

}
